#coding:utf-8
# -*- coding: utf-8 -*-
#单例模式的装饰器
def singleton (cls, *args, **kwargs):
    instances = {}
    def get_instance (*args, **kwargs):
        if cls not in instances:
            instances[cls] = cls(*args, **kwargs)
        return instances[cls]
    return get_instance